<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>事件修饰符</title>
    <style>
        .inner {
            height: 200px;
            background-color: aquamarine;
        }
    </style>
    <script src="./lib/vue-2.4.0.js"></script>
</head>
<body>
    <div id="app">
        <div class="inner" @click="divHandler">
            <!-- 阻止点击 div 时触发 button 被点事件 -->
            <input type="button" value="Click" @click.stop="btnHandler">
        </div>

        <!-- 阻止默认行为 -->
        <a href="www.google.com" @click.prevent="linkHandler">Google It</a>
        <!-- 先触发 div 外层，再触发 button 内层-->
        <div class="inner" @click.capture="divHandler">
            <input type="button" value="Click" @click="btnHandler">
        </div>
    </div>
       


    <script>
    var vm = new Vue({
        el: '#app',
        data: {
            
        },

        methods: {
            divHandler (){
                console.log("You find the inner div.")
            },
            btnHandler() {
                console.log("You find the button.")
            },
            linkHandler() {
                console.log("You find the link.")
            }
        }
    })
    
    </script>
</body>
</html>